package com.zimmur.service.impl.order;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zimmur.dao.order.IOrderDetailDao;
import com.zimmur.model.order.OrderDetail;
import com.zimmur.service.order.IOrderDetailService;

@Service("orderDetailService")
public class OrderDetailServiceImpl implements IOrderDetailService {
	
	
	@Resource
	private IOrderDetailDao orderDetailDao;
	
	@Override
	public boolean insertBatch(List<OrderDetail> list) {
		return orderDetailDao.insertBatch(list)>0?true:false;
	}

	@Override
	public List<OrderDetail> selectByOrderId(Long orderId) {
		return orderDetailDao.selectByOrderId(orderId);
	}

	@Override
	public int deleteByOrderId(Long orderId) {
		return orderDetailDao.deleteByOrderId(orderId);
	}
	
	@Override
	public OrderDetail selectByOrderDetailID(Long orderdetailid) {
		return orderDetailDao.selectByPrimaryKey(orderdetailid);
	}
	
	@Override
	public List<OrderDetail> selectByPrimaryKey(Long orderdetailid) {
		List<OrderDetail> list = new ArrayList<>();
		list.add(orderDetailDao.selectByPrimaryKey(orderdetailid));
		return list;
	}

	@Override
	public int updateByPrimaryKeySelective(OrderDetail record) {
		return orderDetailDao.updateByPrimaryKeySelective(record);
	}

	@Override
	public List<OrderDetail> selectByOrderIdAndIsService(Long orderId) {
		return orderDetailDao.selectByOrderIdAndIsService(orderId);
	}

	@Override
	public boolean updateOrderDetailServiceStatus(OrderDetail detail) {
		return orderDetailDao.updateOrderDetailServiceStatus(detail)>0?true:false;
	}

	@Override
	public OrderDetail selectByDetailIdAndUserId(Long detailId, Long userId) {
		return orderDetailDao.selectByDetailIdAndUserId(detailId,userId);
	}

}
